/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    padding: 40px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 导航样式 */
nav {
    background-color: white;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

nav ul {
    display: flex;
    list-style: none;
    justify-content: center;
    flex-wrap: wrap;
}

nav li {
    margin: 0;
}

nav a {
    display: block;
    padding: 15px 25px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

nav a:hover,
nav a.active {
    color: #667eea;
    border-bottom: 3px solid #667eea;
    background-color: #f8f9ff;
}

/* 主内容样式 */
main {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

section {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

section h2 {
    color: #444;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eaeaea;
    font-size: 2em;
}

/* 预测部分样式 */
.prediction-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.form-container {
    flex: 1;
    min-width: 300px;
    background-color: #f9f9f9;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.result-container {
    flex: 1;
    min-width: 300px;
    background-color: #f9f9f9;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

/* 结果显示样式 */
#prediction-result h3 {
    color: #444;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.result-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.waiting-text {
    color: #999;
    font-size: 16px;
}

#risk-bar {
    margin-top: 20px;
}

.risk-label {
    font-weight: 500;
    margin-bottom: 10px;
    color: #555;
}

.risk-progress {
    width: 100%;
    height: 20px;
    background-color: #eaeaea;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

#risk-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #ff9800, #f44336);
    transition: width 1s ease;
}

#risk-percentage {
    text-align: center;
    font-weight: bold;
    color: #333;
}

#suggestions {
    margin-top: 25px;
    background-color: #e3f2fd;
    padding: 20px;
    border-radius: 5px;
    border-left: 5px solid #2196f3;
}

#suggestions h4 {
    color: #1976d2;
    margin-bottom: 10px;
}

#suggestions-list {
    list-style-position: inside;
    padding-left: 10px;
}

#suggestions-list li {
    margin-bottom: 8px;
    color: #333;
}

/* 统计部分样式 */
.statistics-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.stats-row {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.stats-card {
    flex: 1;
    min-width: 300px;
    background-color: #f9f9f9;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.stats-card.full-width {
    flex: 1 1 100%;
}

.stats-card h3 {
    color: #444;
    margin-bottom: 20px;
    font-size: 1.3em;
    text-align: center;
}

.chart {
    width: 100%;
    height: 300px;
}

/* 表格样式 */
#prediction-history {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#prediction-history th,
#prediction-history td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#prediction-history th {
    background-color: #667eea;
    color: white;
    font-weight: 500;
}

#prediction-history tr:hover {
    background-color: #f5f5f5;
}

/* 关于部分样式 */
.about-container h3 {
    color: #444;
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.about-container p {
    margin-bottom: 15px;
    line-height: 1.8;
    color: #555;
}

.about-container ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.about-container li {
    margin-bottom: 10px;
    color: #555;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .prediction-container {
        flex-direction: column;
    }
    
    .stats-row {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    header p {
        font-size: 1em;
    }
    
    nav ul {
        flex-direction: column;
    }
    
    nav a {
        text-align: center;
        border-bottom: 1px solid #f0f0f0;
    }
    
    nav a:last-child {
        border-bottom: none;
    }
    
    main {
        padding: 20px;
    }
}

/* 加载动画 */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s infinite;
}

/* 预测结果动画 */
@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.result-item {
    animation: slideIn 0.5s ease-out;
    margin-bottom: 15px;
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted #667eea;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* AI聊天样式 */
.chat-container {
    background-color: #f9f9f9;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 20px;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #eaeaea;
}

.message {
    margin-bottom: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}

.user-message {
    background-color: #e3f2fd;
    color: #1565c0;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.bot-message {
    background-color: #f1f8e9;
    color: #33691e;
    border-bottom-left-radius: 2px;
}

.loading-message {
    background-color: #f5f5f5;
    color: #757575;
    position: relative;
}

.loading-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.chat-input-area {
    display: flex;
    gap: 10px;
    align-items: center;
}

#chat-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    resize: none;
    min-height: 45px;
}

#chat-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    padding: 12px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.send-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 响应式聊天界面 */
@media (max-width: 768px) {
    .chat-container {
        height: 500px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-input-area {
        flex-direction: column;
    }
    
    #chat-input {
        width: 100%;
    }
    
    .send-btn {
        width: 100%;
    }
}